package cn.gson.work.model.pojos;

import javax.persistence.*;
import java.util.Objects;

@Entity
public class Profit {
    private long pfId;
    private String pfName;
    private Long pfMoney;
    private Profitcat profitcat;
    private  Project project;

    @Id
    @Column(name = "PF_ID")
    public long getPfId() {
        return pfId;
    }

    public void setPfId(long pfId) {
        this.pfId = pfId;
    }

    @Basic
    @Column(name = "PF_NAME")
    public String getPfName() {
        return pfName;
    }

    public void setPfName(String pfName) {
        this.pfName = pfName;
    }

    @Basic
    @Column(name = "PF_MONEY")
    public Long getPfMoney() {
        return pfMoney;
    }

    public void setPfMoney(Long pfMoney) {
        this.pfMoney = pfMoney;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Profit profit = (Profit) o;
        return pfId == profit.pfId &&
                Objects.equals(pfName, profit.pfName) &&
                Objects.equals(pfMoney, profit.pfMoney);
    }
    @ManyToOne
    @JoinColumn(name = "PFC_ID", referencedColumnName = "PFC_ID")
    public Profitcat getProfitcat() {
        return profitcat;
    }

    public void setProfitcat(Profitcat profitcat) {
        this.profitcat = profitcat;
    }

    @ManyToOne
    @JoinColumn(name = "P_ID", referencedColumnName = "P_ID")
    public Project getProject() {
        return project;
    }

    public void setProject(Project project) {
        this.project = project;
    }



    @Override
    public int hashCode() {
        return Objects.hash(pfId, pfName, pfMoney);
    }
}
